package com.zenaprod.twodcore.graphic.sprite;

import com.zenaprod.framework.log.ZLog;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;


public class SpriteImage {
    protected String imagePath;
    protected BufferedImage image;
    protected int imageTime;

    protected int width, height;


    public SpriteImage(String imagePath, int imageTime) {
        this.imagePath = imagePath;
        this.imageTime = imageTime;
        try {
            this.image = loadImage(imagePath);
        } catch (IOException e) {
            ZLog.e("Unable to load image: " + imagePath, e);
        }
        this.width = image.getWidth();
        this.height = image.getHeight();
    }


    public static BufferedImage loadImage(String imagePath) throws IOException {
        return ImageIO.read(new File(imagePath));
    }
    
    public BufferedImage getImage() {
        return this.image;
    }

    public int getImageTime() {
        return this.imageTime;
    }
    
    public int getWidth() {
        return width;
    }

    public int getHeight() {
        return height;
    }

}
